<?php
header('Content-type: text/html;charset=UTF-8');
header('Cache-Control:no-cache,must-revalidate');  
header('Expires: Sat, 26 Jul 2008 13:14:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Pragma: no-cache');

// 禁止 magic quotes
ini_set('magic_quotes_runtime', 0);
ini_set("display_errors", "On");

error_reporting(E_ALL | E_STRICT);

// change the following paths if necessary
defined('WEB_PATH') ||define('WEB_PATH', dirname(__FILE__).'/..');
defined('LIBRARY_PATH') ||define('LIBRARY_PATH', dirname(__FILE__).'/../library');
defined('CONFIG_PATH') || define('CONFIG_PATH', dirname(__FILE__) . '/../configs');
defined('APP_PATH') || define('APP_PATH', dirname(__FILE__) . '/../application');
defined('VIEWS_PATH') || define('VIEWS_PATH', dirname(__FILE__) . '/../views');
defined('TEMPLATE_PATH') || define('TEMPLATE_PATH', dirname(__FILE__) . '/../templates');
defined('PYBLIC_PATH') || define('PUBLIC_PATH', dirname(__FILE__) . '/../public');

include_once LIBRARY_PATH.'/Core/ClassLoader.php';

//自动加载文件路径
ClassLoader::setBasePath(array(
    WEB_PATH.'/',
));

use library\Core\Config;
use library\Core\Comm\Session;
use application\Comm\Request;
use library\Core\Coder;

//设置配置目录
Config::setBasePath(CONFIG_PATH);

//主动加载

Config::loadParamsConfig('params.php');


Config::loadDbConfig('db.php');
//Config::loadSourcesConfig('sources.conf');
//初动加载
//Config::loadMemcacheConfig('memcache.conf');
//Config::loadRedisConfig('redis.conf');

Request::$_POSTGET = array_merge($_GET,$_POST);
Session::cache_limiter('private');
Session::start();

defined('HOST') || define('HOST', Config::getParamsVal('HOST'));

Coder::createApplication('library\Core\WebApplication')->run();
